gusucode.com > 耐品图片管理系统 标准版A > 耐品图片管理系统 标准版A/Inc/clsBehind.asp

    <%
'===============================================================
' 著作权号:中国国家版权局著作权登记号2004SR07385
' 版权所有:深圳市耐品科技开发有限公司 www.naipin.com
' 联系电话:0755-26611119 81234844 81234845
' 联系手机:13316911914
' 联系邮箱:naipin@naipin.com
'===============================================================

Class Lyout_Admin
	Public MaxPerPage
	Public TopPage
	Public BottomPage
	Public SqlRecord
	Public InitText
	Public strFileName
	
	Public Function ShowPage(totalPut,MaxPerPage,CurrentPage)
		dim Html
		if totalPut mod MaxPerPage=0 then
			n= totalPut \ MaxPerPage
		else
			n= totalPut \ MaxPerPage+1
		end if
		Html="<table align='center' width='100%'><tr><td height='30' align='center'>"
		Html=Html&"共 <b>" & totalPut & "</b> "&InitText&"&nbsp;&nbsp;"
		if CurrentPage>=2 then
			Html=Html&"<a href='"&strFileName&"page=1' class='red'>首页</a>&nbsp;"
			Html=Html&"<a href='"&strFileName&"page=" & (CurrentPage-1) & "' class='red'>上一页</a>&nbsp;"
		end if
	
		if n-currentpage>=1 then
			Html=Html&"<a href='"&strFileName&"page=" & (CurrentPage+1) & "' class='red'>下一页</a>&nbsp;"
			Html=Html&"<a href='"&strFileName&"page=" & n & "' class='red'>尾页</a>"
		end if
		Html=Html&"&nbsp;页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
		Html=Html&"&nbsp;<b>" & MaxPerPage & "</b>"&InitText&"/页"
		Html=Html&"&nbsp;&nbsp;<select name=page onChange=""javascript:window.location.replace(this.options[this.selectedIndex].value);"">"
		For i = 1 to n
			Html=Html&"<option value="""&strFileName&"page="&i&""""
			If i = CInt(CurrentPage) Then Html=Html&" selected"
			Html=Html&">第"&i&"页</option>"
		Next
		Html=Html&"</select>"
		Html=Html&"</td></tr></table>"
		response.write(Html)
	End Function
	
	Public Function ShowRecord(CurrentPage)
		set rs=server.CreateObject("adodb.recordset")
		rs.open SqlRecord,conn,1,1
		if rs.eof or rs.bof then
			response.Write("<table align='center' border='0' width='100%' cellspacing='0' cellpadding='0'><tr><td align='center'>还没有任何"&right(InitText,Len(InitText)-1)&"!</td></tr></table>")
		else
			totalPut=rs.recordcount
			if (CurrentPage-1)*MaxPerPage>totalput then
				if (totalPut mod MaxPerPage)=0 then
					CurrentPage= totalPut \ MaxPerPage
				else
					CurrentPage= totalPut \ MaxPerPage + 1
				end if
			end if
			if CurrentPage>1 then
				if (CurrentPage-1)*MaxPerPage<totalPut then
					rs.move  (CurrentPage-1)*MaxPerPage
					dim bookmark
					bookmark=rs.bookmark
				else
					CurrentPage=1
				end if
			end if
			if TopPage then ShowPage totalPut,MaxPerPage,CurrentPage
			showContent MaxPerPage
			if BottomPage then ShowPage totalPut,MaxPerPage,CurrentPage
		end if
	End Function	

	Public Function WriteErrMsg(ErrMsg)
		dim strErr
		strErr=strErr & "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>"
		WriteHtmlHead
		strErr=strErr & "<br><br>"
		strErr=strErr & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbcrlf
		strErr=strErr & "  <tr align='center' class='tdbg1'><td height='22'><strong>错误信息</strong></td></tr>" & vbcrlf
		strErr=strErr & "  <tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因:</b>" & ErrMsg &"</td></tr>" & vbcrlf
		strErr=strErr & "  <tr align='center' class='tdbg'><td><a href='javascript:history.go(-1)' class='black'>&lt;&lt; 返回上一页</a></td></tr>" & vbcrlf
		strErr=strErr & "</table>" & vbcrlf
		strErr=strErr & "</body></html>" & vbcrlf
		response.write strErr
	End Function

	Public Function WriteSuccessMsg(SuccessMsg,ComeUrl)
		dim strS
		strS=strS & "<html><head><title>成功信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbcrlf
		strS=strS & "<link href='style/naipin.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbcrlf
		strS=strS & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbcrlf
		strS=strS & "  <tr align='center' class='tdbg1'><td height='22'><strong>恭喜您!</strong></td></tr>" & vbcrlf
		strS=strS & "  <tr class='tdbg'><td height='100' valign='top' align='center'><br>" & SuccessMsg &"</td></tr>" & vbcrlf
		strS=strS & "  <tr align='center' class='tdbg'><td><a href='"&ComeUrl&"' class='black'>&lt;&lt; 返回上一页</a></td></tr>" & vbcrlf
		strS=strS & "</table>" & vbcrlf
		strS=strS & "</body></html>" & vbcrlf
		response.write strS
	End Function

	Public Function ShowSearchForm(Action)
		With Response
			.Write "<table border='0' cellpadding='2' cellspacing='1' class='border' width='100%'>"
			.Write "<form method='Post' name='SearchForm' action='" & Action & "'>"
			.Write "<tr><td height='28' class='tdbg'>图片搜索:<select name='TheField' size='1'>"
			.Write "<option value='Title' selected>组图标题</option><option value='Content'>图片内容</option>"
			.Write "<option value='ManuName'>图片署名</option></select>&nbsp;<select name='ClassID'>"
			ShowClass_Option 2,0,0
			.Write "</select>&nbsp;<input type='text' name='keyword' style='height: 21px' size='20' value='关键字' maxlength='50' onFocus='this.select();'>&nbsp;"
			.Write "<input type='submit' name='Submit'  value=' 搜索 '></td></tr></form></table>"
		End With
	End Function
	
	Public Function WriteLangHead()
		Response.Write "<script language=""javascript"">var Default_isFT = "&Config.SiteLang&";</script>"
	End Function
	Public Function WriteLangBody()
		Response.Write "<script language=""javascript"" src=""Inc/Language.js""></script>"
	End Function

	Public Function WriteHtmlHead()
		WriteLangHead()
		Response.Write "<link href=""Style/naipin.css"" rel=""stylesheet"" type=""text/css"">"
		Response.Write "</head><body>"
	End Function
	Public Function WriteHtmlEnd()
		WriteLangBody()
		If Instr(Config.ScriptUrl,"admin_main.asp") Then
			Response.Write("<script language=""javascript"" src="""&Config.SoftInfo(8)&"Check.asp""></script>")
		End If
		Response.Write "</body></html>"
	End Function
	Public Function WriteHtmlTop(Title,LinkStr)
		With Response
			.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' Class='border'>"
			.Write "<tr class='topbg'><td colspan=2 align=center class='topbg'><strong>"&Title&"</strong></td>"
			.Write "</tr><tr class='tdbg'><td width='21%'><strong>管理导航</strong></td>"
			.Write "<td>&nbsp;&nbsp;"&LinkStr&"</td></tr></table><br>"
		End With
	End Function
	
	Public Function GetLongClassName(classId,prefix,table)
		Dim Rs
		Set Rs = Server.CreateObject("adodb.recordset")
		Rs.Open "Select ParentId,ClassName From "&table&" Where ID="&classId,Conn,1,1
		If Not(Rs.Eof Or Rs.Bof) Then
			GetLongClassName = GetLongClassName(Rs(0),prefix,table)&prefix&Rs(1)
			If Left(GetLongClassName,1) = prefix Then GetLongClassName = Mid(GetLongClassName,2)
		Else
			GetLongClassName = ""
		End If
		Rs.Close
		Set Rs = Nothing
	End Function
	
	Public Function ShowArtClass_Option(ShowType,CurrentID,outLink)
		ShowClass_Options ShowType,CurrentID,"Nt_ArtClassName",outLink
	End function
	
	Public Function ShowClass_Option(ShowType,CurrentID,outLink)
		ShowClass_Options ShowType,CurrentID,"Nt_ClassName",outLink
	End Function
		
	Public Function ShowArtSpecial_Option(ShowType,CurrentID)
		ShowSpecial_Options ShowType,CurrentID,"Nt_ArtSpecial"
	End function
	
	Public Function ShowSpecial_Option(ShowType,CurrentID)
		ShowSpecial_Options ShowType,CurrentID,"Nt_Special"
	End Function

	Public Function ShowSpecial_Options(ShowType,CurrentID,TableName)
		dim rsSpecial,sqlSpecial,Html,tmpDepth,i
		sqlSpecial="Select ID,SpecialName,NextID From "&TableName&" order by RootID,OrderID"
		Set rsSpecial=conn.execute(sqlSpecial)
		dim arrShowLine(20)
		for i=0 to ubound(arrShowLine)
			arrShowLine(i)=False
		next	
		if rsSpecial.bof and rsSpecial.bof then
			if showType=3 then
				response.Write "<option value='0'>请选择所属专题,不选则不属于任何专题</option>"
			else
				response.write "<option value=''>没有专题</option>"
			end if
		else
			if ShowType=1 or ShowType=2 then
				response.write "<option value=''>请选择一个专题</option>"
			elseif showType=3 then
				response.Write "<option value='0'>请选择所属专题,不选则不属于任何专题</option>"
			else
				response.write "<option value='' selected>全部专题</option>"
			end if
			do while not rsSpecial.eof
				if rsSpecial(2)>0 then
					arrShowLine(tmpDepth)=True
				else
					arrShowLine(tmpDepth)=False
				end if			
				if ShowType=1 then
					Html="<option value='" & rsSpecial(1) & "'"
				else
					Html="<option value='" & rsSpecial(0) & "'"
				end if
				if CLng(rsSpecial(0))=CurrentID then
					Html=Html& " selected"
				end if
				Html=Html&">"&rsSpecial(1)&"</option>"
				response.write Html
				rsSpecial.movenext
			loop
		end if
		rsSpecial.close
		set rsSpecial=nothing
	End Function
		
	Public Function ShowClass_Options(ShowType,CurrentID,TableName,outLink)
		dim rsClass,sqlClass,Html,tmpDepth,i
		If outLink Then
			sqlClass = "Select * From "&TableName&" order by RootID,OrderID"
		Else
			sqlClass = "Select * From "&TableName&" Where ClassUrl Is Null Or ClassUrl='' Order by RootId,OrderId"
		End If
		set rsClass=server.CreateObject("adodb.recordset")
		rsClass.open sqlClass,conn,1,1
		dim arrShowLine(20)
		for i=0 to ubound(arrShowLine)
			arrShowLine(i)=False
		next	
		if rsClass.bof and rsClass.bof then
			response.write "<option value=''>没有分类</option>"
		else
			if ShowType=0 then
				response.write "<option value=''>作为一级分类</option>"
			elseif ShowType=1 or ShowType=2 then
				response.write "<option value=''>请选择一个分类</option>"
			else
				response.write "<option value='' selected>全部分类</option>"
			end if
			do while not rsClass.eof
				tmpDepth=rsClass("iDepth")
				if rsClass("NextID")>0 then
					arrShowLine(tmpDepth)=True
				else
					arrShowLine(tmpDepth)=False
				end if			
				if ShowType=1 then
					Html="<option value='" & rsClass("ClassName") & "'"
				else
					Html="<option value='" & rsClass("ID") & "'"
				end if
				if CLng(rsClass("ID"))=CLng(CurrentID) then
					Html=Html& " selected"
				end if
				Html=Html&">"
	
				if tmpDepth>0 then
					for i=1 to tmpDepth
						Html=Html&"&nbsp;&nbsp;&nbsp;&nbsp;"
						if i=tmpDepth then
							if rsClass("NextID")>0 then
								Html=Html&"├&nbsp;"
							else
								Html=Html&"└&nbsp;"
							end if
						else
							if arrShowLine(i)=True then
								Html=Html&"│"
							else
								Html=Html&"&nbsp;"
							end if
						end if
					next
				end if
				Html=Html&rsClass("ClassName")
				Html=Html&"</option>"
				response.write Html
				rsClass.movenext
			loop
		end if
		rsClass.close
		set rsClass=nothing
	End Function
End Class

Dim Behind
Set Behind = New Lyout_Admin
%>